﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/WebMaster.Master" AutoEventWireup="true"
    CodeBehind="SalesOrder.aspx.cs" Inherits="MaxStudio.Concrete.Web.Pages.SalesOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script language="javascript" type="text/javascript">
        function CloseDialog() {
            $("#dialog").dialog("close");
        }
        function CloseEditDialog() {
            $("#EditDialog").dialog("close");
        }
        function OpenDialog() {
            $("#EditDialog").dialog("open");
            return false;
        }
        function OpenConfirmDialog() {
            $("#dialog-confirm").dialog("open");
            return false;
        }
        function CloseConfirmDialog() {
            $("#dialog-confirm").dialog("close");
            return false;
        }
        $(function() {
            var dlg = jQuery("#dialog").dialog({
                draggable: true,
                resizable: true,
                closed: true,
                show: 'Transfer',
                hide: 'Transfer',
                autoOpen: false,
                width: 600,
                minHeight: 10,
                minwidth: 10
            });
            dlg.parent().appendTo(jQuery("form:first"));

            var Editdlg = jQuery("#EditDialog").dialog({
                draggable: true,
                resizable: true,
                closed: true,
                show: 'Transfer',
                hide: 'Transfer',
                autoOpen: false,
                width: 600,
                minHeight: 10,
                minwidth: 10
            });
            Editdlg.parent().appendTo(jQuery("form:first"));

            var confirm = jQuery("#dialog-confirm").dialog({
                draggable: true,
                resizable: true,
                closed: true,
                show: 'Transfer',
                hide: 'Transfer',
                autoOpen: false,
                width: 300,
                minHeight: 10,
                minwidth: 10
            });
            confirm.parent().appendTo(jQuery("form:first"));
        });
        $(function() {
            $("#dialog-confirm").dialog({
                resizable: false,
                autoOpen: false,
                height: 140,
                modal: true
            });
        });

           
    </script>

    <div class="LinkMap">
        >>我的位置 >> 订单管理 >> 订单管理
    </div>
    <div>
        <div id="tabs">
            <ul>
                <li><a href="#tabs-1">功能介绍</a></li>
                <li><a href="#tabs-2">订单管理</a></li>
            </ul>
            <div id="tabs-1">
                该功能模块可以添加，修改和删除订单。</div>
            <div id="tabs-2"> 
                <div style="width: auto; margin: 10px;">
                    <p>
                        <a href="#" id="dialog_link" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-newwin">
                        </span>添加订单</a></p>
                        <asp:UpdatePanel ID="UPGridView" runat="server">
                    <ContentTemplate> 
                        <asp:GridView ID="gvSalesOrderList" runat="server" CssClass="GridViewStyle" OnRowCommand="gvSalesOrderList_RowCommand"
                            DataKeyNames="Id" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True"
                            OnPageIndexChanging="gvSalesOrderList_PageIndexChanging" PageSize="20" 
                             >
                            <FooterStyle CssClass="GridViewFooterStyle" />
                            <RowStyle CssClass="GridViewRowStyle" />
                            <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
                            <PagerStyle CssClass="GridViewPagerStyle" />
                            <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                            <HeaderStyle CssClass="GridViewHeaderStyle" />
                            <Columns>
                                <asp:BoundField DataField="ID" HeaderText="编号" />
                                <asp:BoundField DataField="ContranctSN" HeaderText="订单号" />
                                <asp:BoundField DataField="CustomerId" HeaderText="下单客户" />
                                <asp:BoundField DataField="SignDate" HeaderText="签约日期" />
                                <asp:BoundField DataField="Status" HeaderText="状态" />
                                <asp:BoundField DataField="CreateDate" HeaderText="创建时间" />
                                <asp:BoundField DataField="ModifyDate" HeaderText="修改时间" />
                                <asp:TemplateField HeaderText="修改">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbtnEdit" runat="server" CausesValidation="False" CommandName="Select"
                                            Text="修改" CommandArgument='<%# Bind("Id") %>' OnClientClick="OpenDialog();"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="删除">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbtnDelete" runat="server" CausesValidation="False" CommandName="del"
                                            Text="删除" CommandArgument='<%# Bind("Id") %>' OnClientClick="OpenConfirmDialog()"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </ContentTemplate>
                </asp:UpdatePanel>
                    <!-- ui-dialog -->
                    <div id="dialog" title="添加订单">
                        <div style="height: auto;">
                            <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left;">
                                        订单号:</div>
                                    <div>
                                        <asp:TextBox runat="server" ID="txtContranctSN" SkinID="SHORTTB"></asp:TextBox>
                                    </div>
                                </div>
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        客户名:</div>
                                    <asp:DropDownList runat="server" ID="ddlCustomer">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        签约日期:</div>
                                    <asp:TextBox runat="server" ID="txtSignDate" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        总计金额:</div>
                                    <asp:TextBox runat="server" ID="txtFullPrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                            </div>
                            
                             <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        泵送费:</div>
                                    <asp:TextBox runat="server" ID="txtPumpingPrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        超出公里数收费:</div>
                                    <asp:TextBox runat="server" ID="txtOutKMPrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                            </div>
                            
                             <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        其他费:</div>
                                    <asp:TextBox runat="server" ID="txtOtherPrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        混凝土价格:</div>
                                    <asp:TextBox runat="server" ID="txtConcretePrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                            </div> 
                            
                            <hr />
                            <div style="width: 100%; height: auto;">
                                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                    <ContentTemplate>
                                        <div>
                                            <b>订单产品</b>
                                        </div>
                                        <div style="width: 100%;">
                                            产品:
                                            <asp:DropDownList ID="ddlAddProInAdding" runat="server">
                                            </asp:DropDownList>
                                            单位:
                                            <asp:DropDownList ID="ddlAddUnitInAdding" runat="server">
                                                <asp:ListItem Value="0">按吨计算</asp:ListItem>
                                                <asp:ListItem Value="1">按立方计算</asp:ListItem>
                                            </asp:DropDownList>
                                            数量:
                                            <asp:TextBox runat="server" ID="txtAddCountInAdding" SkinID="SHORTTB"></asp:TextBox>
                                            <asp:Button runat="server" ID="btnAddInAdding" Text="添加" OnClick="btnAddInAdding_Click" />
                                        </div>
                                        <div style="text-align: center;">
                                            <asp:GridView ID="gvProductAdding" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                                ForeColor="#333333" GridLines="None" Width="90%" 
                                                OnRowDeleting="gvProductAdding_RowDeleting" DataKeyNames="ProductId,UnitId,Count">
                                                <RowStyle BackColor="#EFF3FB" />
                                                <Columns>
                                                    <asp:BoundField DataField="ProductId" HeaderText="ProductId" Visible="false" />
                                                    <asp:BoundField DataField="Product" HeaderText="产品" />
                                                    <asp:BoundField DataField="Unit" HeaderText="单位" />
                                                    <asp:BoundField DataField="UnitId" HeaderText="UnitId" Visible="false"   />
                                                    <asp:BoundField DataField="Count" HeaderText="数量" />
                                                    <asp:CommandField ShowDeleteButton="True" DeleteText="删除" />
                                                </Columns>
                                                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                                <EditRowStyle BackColor="#2461BF" />
                                                <AlternatingRowStyle BackColor="White" />
                                            </asp:GridView>
                                        </div>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                            <hr />
                            <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        跟踪人:</div><asp:DropDownList runat="server" ID="ddlTraker">
                                        </asp:DropDownList>
                                    </div>
                                 
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        状态:</div><asp:DropDownList runat="server" ID="ddlStatus">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                            </div>
                            <div style="float: left; width: 100%;">
                                <div style="width: 100px; float: left">
                                    条款:</div>
                                <asp:TextBox runat="server" ID="txtProvision" TextMode="MultiLine" Width="80%" Height="100px"></asp:TextBox>
                            </div>
                            <div style="float: left; width: 100%;">
                                <div style="width: 100px; float: left">
                                    描述:</div>
                                <asp:TextBox runat="server" ID="txtDescription" TextMode="MultiLine" Width="80%"
                                    Height="100px"></asp:TextBox>
                            </div>
                            <br />
                            <div style="width: 500px; text-align: right">
                                <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click"
                                    OnClientClick="CloseDialog()" />
                                <input id="btnCancel" type="button" value="Cancel" onclick="CloseDialog()" />
                            </div>
                        </div>  
                <!-- ui- Edit dialog -->
                <div id="EditDialog" title="用户修改">
                    <asp:UpdatePanel ID="UPEdit" runat="server">
                        <ContentTemplate>
                            <div style="height: auto;">
                                <asp:Label runat="server" ID="lbEidtId" Visible="false"></asp:Label>
                               <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left;">
                                        订单号:</div>
                                    <div>
                                        <asp:TextBox runat="server" ID="txtEditContranctSN" SkinID="SHORTTB"></asp:TextBox>
                                    </div>
                                </div>
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        客户名:</div>
                                    <asp:DropDownList runat="server" ID="ddlEditCustomer">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        签约日期:</div>
                                    <asp:TextBox runat="server" ID="txtEditSignDate" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        总计金额:</div>
                                    <asp:TextBox runat="server" ID="txtEditFullPrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                            </div>
                              <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        泵送费:</div>
                                    <asp:TextBox runat="server" ID="txtEditPumpingPrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        超出公里数收费:</div>
                                    <asp:TextBox runat="server" ID="txtEditOutKMPrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                            </div>
                            
                             <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        其他费:</div>
                                    <asp:TextBox runat="server" ID="txtEditOtherPrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        混凝土价格:</div>
                                    <asp:TextBox runat="server" ID="txtEditConcretePrice" SkinID="SHORTTB"></asp:TextBox>
                                </div>
                            </div>
                            
                                
                            <hr />
                            <div style="width: 100%; height: auto;">
                                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                                    <ContentTemplate>
                                        <div>
                                            <b>订单产品</b>
                                        </div>
                                        <div style="width: 100%;">
                                            产品:
                                            <asp:DropDownList ID="ddlEditAddProInAdding" runat="server">
                                            </asp:DropDownList>
                                            单位:
                                            <asp:DropDownList ID="ddlEditAddUnitInAdding" runat="server">
                                                <asp:ListItem Value="0">按吨计算</asp:ListItem>
                                                <asp:ListItem Value="1">按立方计算</asp:ListItem>
                                            </asp:DropDownList>
                                            数量:
                                            <asp:TextBox runat="server" ID="txtEditAddCountInAdding" SkinID="SHORTTB"></asp:TextBox>
                                            <asp:Button runat="server" ID="btnEditAddInAdding" Text="添加" OnClick="btnEditAddInAdding_Click" />
                                        </div>
                                        <div style="text-align: center;">
                                            <asp:GridView ID="gvEditProductAdding" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                                ForeColor="#333333" GridLines="None" Width="90%" OnRowDeleting="gvEditProductAdding_RowDeleting">
                                                <RowStyle BackColor="#EFF3FB" />
                                                <Columns>
                                                    <asp:BoundField DataField="ProductId" HeaderText="ProductId" Visible="false" />
                                                    <asp:BoundField DataField="Product" HeaderText="产品" />
                                                    <asp:BoundField DataField="Unit" HeaderText="单位" />
                                                    <asp:BoundField DataField="Count" HeaderText="数量" />
                                                    <asp:CommandField ShowDeleteButton="True" DeleteText="删除" />
                                                </Columns>
                                                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                                <EditRowStyle BackColor="#2461BF" />
                                                <AlternatingRowStyle BackColor="White" />
                                            </asp:GridView>
                                        </div>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                            <hr />
                            <div style="width: 100%;">
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        跟踪人:</div><asp:DropDownList runat="server" ID="ddlEditTraker">
                                        </asp:DropDownList>
                                    </div>
                                 
                                <div style="float: left; width: 50%;">
                                    <div style="width: 100px; float: left">
                                        状态:</div><asp:DropDownList runat="server" ID="ddlEditStatus">
                                        </asp:DropDownList>
                                    </div>
                                </div>
                            </div>
                            <div style="float: left; width: 100%;">
                                <div style="width: 100px; float: left">
                                    条款:</div>
                                <asp:TextBox runat="server" ID="txtEditProvision" TextMode="MultiLine" Width="80%" Height="100px"></asp:TextBox>
                            </div>
                            <div style="float: left; width: 100%;">
                                <div style="width: 100px; float: left">
                                    描述:</div>
                                <asp:TextBox runat="server" ID="txtEditDescription" TextMode="MultiLine" Width="80%"
                                    Height="100px"></asp:TextBox>
                            </div>
                            <br />
                                <br />
                                <div>
                                    最后修改人:
                                    <asp:Label runat="server" ID="lbLastModier"></asp:Label>
                                </div>
                                <div>
                                    最后修改时间:
                                    <asp:Label runat="server" ID="lbLastModifyDate"></asp:Label>
                                </div>
                                <br />
                                <div style="width: 500px; text-align: right">
                                    <asp:Button ID="btnEdit" runat="server" Text="Submit" OnClick="btnEdit_Click" OnClientClick="CloseEditDialog()" />
                                    <input id="btnCancelEdit" type="button" value="Cancel" onclick="CloseEditDialog()" />
                                </div>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
               
                <!-- ui- delete dialog -->
                <div id="dialog-confirm" title="删除确认?">
                    <asp:UpdatePanel ID="upDelete" runat="server">
                        <ContentTemplate>
                            <p>
                                <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
                                确定要删除吗？</p>
                            <asp:Label runat="server" ID="lbDeleteId" Visible="false"></asp:Label>
                            <div style="width: 270px; text-align: right">
                                <asp:Button ID="btnConfirmDelete" runat="server" Text="Submit" OnClick="btnDelete_Click"
                                    OnClientClick="CloseConfirmDialog()" />
                                <input id="btnCancelDelete" type="button" value="Cancel" onclick="CloseConfirmDialog()" />
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
                 
                 </div>
            </div>
        </div>
    </div>
    
</asp:Content>
